﻿using CommonType;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S_Gridding.Domains.BasicData;
using S_Gridding.Read.Api.Command;

namespace S_Gridding.Read.Api.Controllers
{
    /// <summary>
    /// 网络类型管理信息控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class MeshTypeController : ControllerBase
    {
        private readonly IMediator _mediator;

        public MeshTypeController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 显示、分页网络类型管理信息
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<PageResule<MeshTypeInfo>> PageShowCottage([FromQuery] ShowMeshTypeCommand s)
        {
            return await _mediator.Send(s);
        }

        /// <summary>
        /// 反填网格类型信息
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<MeshTypeInfo> BackMeshType([FromQuery]BackMeshTypeCommand m)
        {
            return await _mediator.Send(m);
        }
    }
}
